<template>
    <div class="detail">
<mt-header :title="details.name">
<router-link to="/" slot="left">
<mt-button icon="back">返回</mt-button>
  </router-link>
</mt-header>
            <div class="d1"><img :src='details.avaUrl' alt=""></div>
            <span class="span1"><h3><img src="../assets/name.png" alt="">{{details.name}}</h3></span>
            <p style="text-indent:2em"><img src="../assets/flag.png" alt=""> {{details.detail}}</p>

            <!-- <button @click="add()">加入购物车</button> -->
            <van-goods-action>
                <van-goods-action-icon icon="chat-o" text="客服" />
                <van-goods-action-icon icon="shop-o" text="店铺" />
                <van-goods-action-button color="#be99ff" type="warning" text="加入购物车"  @click="add()"/>
                <van-goods-action-button color="#7232dd" type="danger" text="立即购买" />
            </van-goods-action>
    </div>
</template>
<script>
import url from "../tools/url"
import { Indicator } from 'mint-ui';

export default {
    name:"detail",
    data() {
        return {
            details:[],
            selected:"详情页"
        }
    },
    methods: {
        add(){
        this.$store.commit("arrChange",this.details)
        }
    },
    mounted() {
        var id=this.$route.query.id;
        var str=`token=${sessionStorage.getItem("token")}&&id=${id}`
        this.axios.post(url.GETCHECKDETAILBYID,str).then(pro=>{
            this.details=pro.data.data;
            this.$set(this.details,"num",1);
              Indicator.close();
        })
       
       
       /*  console.log(this.$route.query.details);
        if(!sessionStorage.getItem("detail")){
            var detail=JSON.stringify(this.$route.query.details);
            sessionStorage.setItem("detail",detail);
            this.details=JSON.parse(sessionStorage.getItem("detail"))
        }else{
            this.details=JSON.parse(sessionStorage.getItem("detail"))
        }
    },
     destroyed() {
           sessionStorage.removeItem("detail");
    }, */
    },
    computed: {
    
    },
}
</script>
<style scoped>
.d1{
    width: 100%;
    height: 50%;
}
.d1 img{
    width: 100%;
    height: 100%;
}
.span1{
    color:red;
}
</style>